import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { AgreementVO, AgreementForm, AgreementQuery } from '@/api/basedata/agreement/types';

/**
 * 查询框架协议维护列表
 * @param query
 * @returns {*}
 */

export const listAgreement = (query?: AgreementQuery): AxiosPromise<AgreementVO[]> => {
  return request({
    url: '/basedata/agreement/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询框架协议维护详细
 * @param id
 */
export const getAgreement = (id: string | number): AxiosPromise<AgreementVO> => {
  return request({
    url: '/basedata/agreement/' + id,
    method: 'get'
  });
};

/**
 * 新增框架协议维护
 * @param data
 */
export const addAgreement = (data: AgreementForm) => {
  return request({
    url: '/basedata/agreement',
    method: 'post',
    data: data
  });
};

/**
 * 修改框架协议维护
 * @param data
 */
export const updateAgreement = (data: AgreementForm) => {
  return request({
    url: '/basedata/agreement',
    method: 'put',
    data: data
  });
};

/**
 * 删除框架协议维护
 * @param id
 */
export const delAgreement = (id: string | number | Array<string | number>) => {
  return request({
    url: '/basedata/agreement/' + id,
    method: 'delete'
  });
};
